Skip to content

dev: add DEV_UNLIMITED mock worker and UI toggle for local dev proxy#74

Open
SaintD1smas wants to merge 2 commits intofarzaa:mainfrom
SaintD1smas:feature/dev-unlimited-mode
Open

dev: add DEV_UNLIMITED mock worker and UI toggle for local dev proxy#74
SaintD1smas wants to merge 2 commits intofarzaa:mainfrom
SaintD1smas:feature/dev-unlimited-mode

Conversation

@SaintD1smas
Copy link
Copy Markdown

Adds DEV_UNLIMITED mock SSE in worker, dev_server.js, and UI toggle in CompanionPanelView and CompanionManager to allow local testing against a dev proxy (no real API calls). Intended for local development only.

@qodo-ai-reviewer
Copy link
Copy Markdown

Hi, The dev worker base URL is accepted from a free-form text field and stored without validation, but both ClaudeAPI and ElevenLabsTTSClient force-unwrap URL(string:), so malformed input can crash the app when clients are recreated.

Severity: action required | Category: reliability

How to fix: Validate URL before saving

Agent prompt to fix - you can give this to your LLM of choice:

Issue description

Dev proxy URL is user-entered and stored without validation, but downstream clients force-unwrap URL initialization, which can crash the app.

Issue Context

User input flows: CompanionPanelView TextField → CompanionManager.setDevWorkerBaseURLworkerBaseURLClaudeAPI(proxyURL: ...) / ElevenLabsTTSClient(proxyURL: ...)URL(string:)!.

Fix Focus Areas

  • leanring-buddy/CompanionManager.swift[140-154]
    • Validate trimmed with URLComponents/URL (require http/https scheme, host present) before persisting.
    • If invalid, do not update UserDefaults and expose an error state to the UI.
  • leanring-buddy/ClaudeAPI.swift[17-20]
    • Replace force-unwrap with throwing init or graceful error.
  • leanring-buddy/ElevenLabsTTSClient.swift[23-25]
    • Replace force-unwrap with throwing init or graceful error.
  • leanring-buddy/CompanionPanelView.swift[651-697]
    • Display validation error and disable Save when invalid.

Spotted by Qodo code review - free for open-source projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants